package demo;


import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/con")
@RestController
public class Controller {

    //获取url
    @Value("${spring.datasoure.url}")
    private String url;

    @PostConstruct
    public void get() {
        System.out.println("================");
        System.out.println("spring.datasoure.url"+url);
        System.out.println("================");
    }

    //获取端口号
    @Value("${server.port}")
    private String port;

    @RequestMapping("/get")
    public String getValue() {
        return "port="+port;
    }
}
